
<script type="text/javascript">
 
  function checknode(obj)
  {
      var chk = $("input[type='checkbox']");
      var count = chk.length;
      var num = chk.index(obj);
      var level_top = level_bottom =  chk.eq(num).attr('level');
      for (var i=num; i>=0; i--)
      {
              var le = chk.eq(i).attr('level');
              if(eval(le) < eval(level_top)) 
              {
                  chk.eq(i).attr("checked",true);
                  var level_top = level_top-1;
              }
      }
      for (var j=num+1; j<count; j++)
      {
              var le = chk.eq(j).attr('level');
              if(chk.eq(num).attr("checked")=='checked') {
			 
                  if(eval(le) > eval(level_bottom)) chk.eq(j).attr("checked",true);
                  else if(eval(le) == eval(level_bottom)) break;
              }
              else {
                  if(eval(le) > eval(level_bottom)) chk.eq(j).attr("checked",false);
                  else if(eval(le) == eval(level_bottom)) break;
              }
      }
  }
</script>
<style>.mainnav_title{display:none;}span.w1{float:left;width:89px}</style>
<form id="myform" name="myform" action="{:U('Access/insert')}" method="post">
<input type="hidden" id="rid" name="rid" value="{$rid}" />
<div class="pad-lr-10">
<div class="table-list">
    <table width="100%" cellspacing="0"  style="border:1px solid #ccc;" id="dnd-example"> 
	<tbody>
	<tr>
		<td width=100 bgcolor="#CBE0F6">
		<input type='checkbox' name='nid[1]' value='1'  level='0' {if array_key_exists(1,$alist)}checked{/if}  onclick='javascript:checknode(this);' />{$topnode[0][title]}
		</td>
		<td bgcolor="#CBE0F6"></td>
	</tr>
	<volist name="node" id="r" >
	 
		<tr>
		<td  colspan="2" bgcolor="#F0F5FB" align="center" height="40"><b>{$r[groupinfo][name]}</b></td>
		</tr>
			<volist name="r[data]" id="rr">
			
			<if condition="$rr[level]==2">
			<tr>
			<td style='padding-left:15px;' bgcolor="#F8FAFC"><input type='checkbox' name='nid[{$rr.id}]' value='{$rr.id}'  level='{$rr.level}' {$rr.selected}  onclick='javascript:checknode(this);' />&nbsp;{$rr.title}
			</td>
			
			<td><volist name="node[$rr[groupid]][data]" id="rrr" >				
						<if condition="$rrr[pid]==$rr[id]">
						<span class="w1"><input type='checkbox' name='nid[{$rrr.id}]' value='{$rrr.id}'  level='{$rrr.level}' {$rrr.selected}  onclick='javascript:checknode(this);' /> {$rrr.title} &nbsp;</span>
						
						</if>
						</volist></td>
			
			</tr>	
					 
			</if>
			</volist>
	 
	</volist>
	<input type="hidden" name="isajax" value="1" />
	<input name="dosubmit" type="submit" value="1" class="hidden" id="dosubmit"> 
	</tbody>
    </table>
</div>
</div>
</form></div>
 